package com.bookocean.infrastructure.persistence.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bookocean.infrastructure.persistence.po.BadgeDefinitionPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 徽章定义 Mapper 接口
 * 
 * @author BookOcean
 * @since 2024-01-01
 */
@Mapper
public interface BadgeDefinitionMapper extends BaseMapper<BadgeDefinitionPO> {

    /**
     * 查询所有启用的徽章定义
     * 
     * @return 徽章定义列表
     */
    @Select("SELECT * FROM badge_definition_po WHERE is_active = 1 ORDER BY badge_id ASC")
    List<BadgeDefinitionPO> selectActiveBadges();

    /**
     * 根据分类查询徽章定义
     * 
     * @param category 徽章分类
     * @return 徽章定义列表
     */
    @Select("SELECT * FROM badge_definition_po WHERE category = #{category} AND is_active = 1 ORDER BY badge_id ASC")
    List<BadgeDefinitionPO> selectBadgesByCategory(@Param("category") String category);
}
